<!--
 * @Author: 梁志恒 1067531094@qq.com
 * @Date: 2022-10-08 19:27:32
 * @LastEditors: 梁志恒 1067531094@qq.com
 * @LastEditTime: 2022-10-08 19:46:36
 * @FilePath: \作业需求\demo02.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let persons = [
            {
                "username": "xiaoming1",
                "password": "1111"
            },
            {
                "username": "xiaoming2",
                "password": "222",
            },
            {
                "username": "xiaoming3",
                "password": "33333"
            },
            {
                "username": "xiaoming2333",
                "password": "222"
            },
            {
                "username": "xiaoming5333",
                "password": "222"
            }
        ]
        let user = { username: "xiaoming5333", password: "222" }
        let reg = persons.findIndex((item) => {
            return item.username == user.username && item.password == user.password
        })
        if (reg == -1) {
            alert('该用户没有注册')
        } else {
            alert('登陆成功')
        }
    </script>
</body>

</html>